<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <style>
        .box {
            width: 200px;
            border: 1px solid blue;
            cursor: pointer;
        }
    </style>
</head>

<body>

    <div class="box">
        <span>购物车</span>
        <div class="detail" style="display: none">
            购物车的相关信息
        </div>
    </div>
    <script>
        let box = document.querySelector('.box');
        let details = document.querySelector('.detail');
        box.onclick = function () {
            let dis = details.style.display
            if (dis === 'none') {
                details.style.display = 'block'
                details.style.borderTopColor = '#fff'
            } else {
                details.style.display = 'none'
            }
        }
    </script>
</body>

</html>